package com.WaVel.mapper;

import com.Emplyment.dto.StudyMaterialDto;
import com.Emplyment.vo.StudyMaterialsVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StudyMaterialMapper {

    @Select("SELECT id, file_name, file_type, file_size FROM study_materials")
    List<StudyMaterialDto> getStudyMaterial();

    @Insert("INSERT INTO study_materials(file_name, file_type, file_size,file) VALUES(#{fileName}, #{fileType}, #{fileSize},#{file})")
    void addStudyMaterial(StudyMaterialsVo studyMaterialsVo);

    @Delete("DELETE FROM study_materials WHERE id = #{id}")
    void deleteStudyMaterial(Integer id);

    @Select("SELECT * FROM study_materials WHERE id = #{id}")
    StudyMaterialsVo getStudyMaterialById(Integer id);
}
